#ifndef COMMANPAGE_H
#define COMMANPAGE_H

#include <QWidget>
#include <QPixmap>
#include "listitem.h"
#include <QListWidget>
#include "musiclist.h"
#include <QDebug>
#include <QMediaPlaylist>
#include <QModelIndex>
#include "mlabel.h"



namespace Ui {
class CommanPage;
}

enum MusicPageType
{
    LIKE_PAGE,
    LOCAL_PAGE,
    HISTORY_PAGE
};

class CommanPage : public QWidget
{
    Q_OBJECT

public:
    explicit CommanPage(QWidget *parent = nullptr);
    ~CommanPage();

    void setMusicPageType(MusicPageType musicPageType);

    void setCommanPageUi(const QString&titleText,const QString &coverPath);

    void addMusicToMusicPage(MusicList* musicList);

    void addMusicToPlayList(MusicList*musicList,QMediaPlaylist*playList);

    void reFresh(MusicList *musicList);

    QString getMusicIdByIndex(int index);
signals:
    void updateLikeMusic(bool isLike,const QString&musicId);
    void playAllClick(MusicPageType pageType);
    void playMusicByIndex(CommanPage*page,int index);
    void moreSet(QMenu*,int,int);

    void moreItemPlayClick(const QString&musicId);
    void moreItemNextClick(const QString&musicId);
    void moreItemDeleteClick(const QString&musicId);
    void moreItemCommendClick(const QString&musicId);
private slots:
    void on_playAll_clicked();

private:
    Ui::CommanPage *ui;

    MusicPageType musicPageType;

    QVector<QString> musicOfPage;



};

#endif // COMMANPAGE_H
